//
//  CYCommentModel.m
//  cyydt
//
//  Created by chu on 2019/1/23.
//  Copyright © 2019 chu. All rights reserved.
//

#import "CYCommentModel.h"

@implementation CYCommentModel
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    if ([key isEqualToString:@"id"]) {
        self.ID = value;
    }
}

- (void)setValue:(id)value forKey:(NSString *)key{
    [super setValue:value forKey:key];

}

+ (instancetype)modelWithDictionary:(NSDictionary *)dic{
    NSMutableDictionary *mudic = [NSMutableDictionary dictionaryWithDictionary:dic];
    NSMutableArray *muRep = [NSMutableArray arrayWithCapacity:0];
    if ([mudic[@"replies"] isKindOfClass:[NSArray class]]) {
        NSArray *replies = mudic[@"replies"];
        for (NSDictionary *dic in replies) {
            CYCommentModel *model = [CYCommentModel modelWithDictionary:dic];
            [muRep addObject:model];
        }
    }
    [mudic setObject:muRep forKey:@"replies"];
    return [[self alloc] initWithDictionary:mudic];
}

@end
